package flc.ast;

import android.app.Application;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.AppUtils;
import com.stark.usersysui.lib.event.UserSysEventImpl;

import flc.ast.inf.UserSysListenerImpl;
import stark.common.apis.ApiManager;
import stark.common.base.IReqRetCallback;
import stark.common.basic.event.usersys.UserSysConfig;
import stark.common.basic.event.usersys.UserSysEventProxy;
import stark.common.basic.view.container.StkEventContainer;

/**
 * create by fanlc
 * on 1/7/21
 * description
 */
public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        StkEventContainer.showInDebug = false;
        //需要配置用户系统时，请添加下面这行代码，不需要时，请删除
        UserSysEventProxy proxy = UserSysEventProxy.getInstance();
        proxy.setProxy(new UserSysEventImpl(0));
        UserSysConfig config = new UserSysConfig();
        config.buyAttention = getString(R.string.be_careful) + AppUtils.getAppName() + getString(R.string.be_careful_content);
        proxy.setUserSysConfig(config);

        ApiManager.appSwitchApi().getGeneralSwitch(null, new IReqRetCallback<Boolean>() {
            @Override
            public void onResult(boolean success, String msg, @Nullable Boolean result) {
                if (result) {
                    config.setListener(new UserSysListenerImpl());
                }
            }
        });
    }
}
